package com.kktestspb.demo.dao;

import com.kktestspb.demo.polo.User;
import com.kktestspb.demo.polo.Visitor;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 来访者记录 持久层操作
 * 业务需求 仅需提供 插入和查询操作即可
 * @author kk
 * @date 2019-09-01 20:30
 */
@Component
@Mapper
public interface VisitorDaoInt {

    /**
     * 查询所有
     * @return
     */
    @Select("select * from k_visitor ")
    List<Visitor> getVisitorList();

    /**
     * 按ID查询
     * @param id
     * @return
     */
    @Select("select * from k_visitor where v_id=#{id}")
    User getVisitorById(@Param("id") String id);


    @Insert("insert into k_visitor(v_ip_address,v_visit_date,v_visit_method) values(" +
            "#{vIpAddress},#{vVisitDate},#{vVisitMethod})")
    void insertVisitor(Visitor visitor);
}
